package com.jacobson.core.widget.security

/**
 * ================================================
 *
 *  @author Wucz on 2018/8/6 14:47
 * ================================================
 */

object SecurityUtils {

    fun getSubject(): Subject = SecurityStorage.getSubject() ?: let {
        SecurityStorage.bindSubject(buildSubject())!!
    }


    private fun getSecurityManager(): SecurityManager = SecurityStorage.getSecurityManager()

    private fun buildSubject(): Subject {
        return getSecurityManager().createSubject(null)
    }
}